const manage_op = [
  { value: '北流镇' },
  { value: '新荣镇' },
  { value: '民安镇' },
  { value: '山围镇' },
  { value: '民乐镇' },
  { value: '西埌镇' },
  { value: '新圩镇' },
  { value: '大里镇' },
  { value: '塘岸镇' },
  { value: '清水口镇' },
  { value: '隆盛镇' },
  { value: '大坡外镇' },
  { value: '六麻镇' },
  { value: '新丰镇' },
  { value: '沙垌镇' },
  { value: '平政镇' },
  { value: '扶新镇' },
  { value: '白马镇' },
  { value: '大伦镇' },
  { value: '六靖镇' },
  { value: '石窝镇' },
  { value: '华东镇' },
  { value: '清湾镇' },
  { value: '其他' },
];

const data_op = [
  { value: '数据漫入' },
  { value: '列车购票' },
  { value: '航班购票' },
  { value: '学生信息' },
  { value: '涉疫人员' },
  { value: '出入境人员' },
  { value: '其他' },
];

const data_type = {
  // 字段： [宽度，是否必填，固定列，标签数, 是否搜索,数据类型]
  辖区: {
    width: 100,
    cols: true,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'auto',
    defVal: manage_op,
  },
  姓名: {
    width: 100,
    cols: true,
    required: true,
    fixed: '',
    tags: 1,
    search: true,
    type: 'text',
    defVal: '',
  },
  性别: {
    width: 60,
    cols: true,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'radio',
    defVal: ['男','女'],
  },

  身份证号: {
    width: 160,
    cols: true,
    required: true,
    fixed: '',
    tags: 1,
    search: true,
    type: 'sfz',
    defVal: '',
  },
  电话号码: {
    width: 100,
    cols: true,
    required: true,
    fixed: '',
    tags: 3,
    search: true,
    type: 'text',
    defVal: '',
  },
  职业: {
    width: 100,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'text',
    defVal: '',
  },

  户籍地址: {
    width: 230,
    cols: true,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'text',
    defVal: '',
  },
  实际居住地: {
    width: 230,
    cols: true,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'text',
    defVal: '',
  },
  健康状况: {
    width: 100,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'text',
    defVal: '',
  },

  是否到达玉林: {
    width: 120,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'radio',
    defVal: ['待核查','来玉途中','已到达玉林'],
  },
  来玉时间: {
    width: 120,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'date',
    defVal: null,
  },
  离玉时间: {
    width: 120,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'date',
    defVal: null,
  },

  '本市人员/市外人员': {
    width: 150,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'radio',
    defVal: ['待核查','本市人员',,'外市人员'],
  },
  来自何地: {
    width: 200,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'text',
    defVal: '',
  },
  扫码情况: {
    width: 150,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'text',
    defVal: '',
  },

  人员轨迹: {
    width: 250,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'textArea',
    defVal: '',
  },
  是否做过核酸检测: {
    width: 200,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'textArea',
    defVal: '',
  },
  '最新一次核酸检测日期、结果': {
    width: 230,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'textArea',
    defVal: '',
  },

  是否感染过新冠肺炎病毒: {
    width: 200,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'textArea',
    defVal: '',
  },
  核查情况: {
    width: 250,
    cols: false,
    required: false,
    fixed: '',
    tags: 5,
    search: false,
    type: 'textArea',
    defVal: '',
  },
  措施: {
    width: 250,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'textArea',
    defVal: '',
  },

  是否下发乡镇跟进: {
    width: 150,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'radio',
    defVal: ['待处理', '已发乡镇跟进'],
  },
  管控状态: {
    width: 150,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: true,
    type: 'radio',
    defVal: ['待核查', '管控中', '已过管控期'],
  },
  管控时间: {
    width: 150,
    cols: false,
    required: false,
    fixed: '',
    tags: 1,
    search: false,
    type: 'date',
    defVal: null,
  },

  // 乡镇反馈: {
  //   width: 250,
  //   cols: false,
  //   required: false,
  //   fixed: '',
  //   tags: 1,
  //   search: true,
  //   type: 'textArea',
  //   defVal: '',
  // },
  备注: {
    width: 250,
    cols: false,
    required: false,
    fixed: '',
    tags: 5,
    search: true,
    type: 'textArea',
    defVal: '',
  },
  数据来源: {
    width: 250,
    cols: false,
    required: true,
    fixed: '',
    tags: 5,
    search: true,
    type: 'auto',
    defVal: data_op,
  },
};

const keys = Object.keys(data_type);

const get_cols = () => {
  var cols = [{ title: '序号', dataIndex: '序号', width: 60 }];
  keys.forEach((key) => {
    if (data_type[key].cols) {
      cols.push({
        title: key,
        dataIndex: key,
        width: data_type[key].width,
        ellipsis: true,
        tags: data_type[key].tags,
      });
    }
  });
  return cols;
};

const get_table_cols = () => {
  var cols = [];
  keys.forEach((key) => {
    cols.push({
      title: key,
      dataIndex: key,
      width: data_type[key].width,
      ellipsis: true,
      tags: data_type[key].tags,
    });
  });
  return cols;
};

const get_cols_width = () => {
  var width = 0;
  var key = Object.keys(get_cols())
  key.forEach((k) => {
    width += get_cols()[k].width;
  });
  return width;
};

const get_table_bd_tags = () => {
  var tags = {};
  keys.forEach((key, id) => {
    tags[key] = [];
  });
  return tags;
};

export default {
  cols: get_cols(),
  table_cols: get_table_cols(),
  table_cols_width: get_cols_width(),
  table_cols_tags: keys,
  table_bd_tags: get_table_bd_tags(),
  data_op: data_op,
  manage_op:manage_op,

  data_type: data_type,
  keys: keys,
  width:get_cols_width(),
  pageSize:100,
  
};
